package lingou.homework.postbar.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.oas.annotations.EnableOpenApi;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;

//@Configuration
//@EnableOpenApi
public class SwaggerConfig {

    @Bean
    Docket docket(){
        //选择版本3
        return new Docket(DocumentationType.OAS_30)
                //选择生成的接口文档
                .select()
//              //包所在的路径
                .apis(RequestHandlerSelectors.basePackage("lingou.homework.postbar.tmp"))
                //默认报下所有的接口都生成
//                .paths(PathSelectors.any())
                .paths(PathSelectors.any())
                .build()
                //接口文档初始化
                .apiInfo(apiInfo());
    }

    private ApiInfo apiInfo() {
        return new ApiInfoBuilder()
//                .description("hett")
//                .contact(new Contact("lingou",null,"1771084007@qq.com"))
                .version("1.0")
                .title("postbar")
                .build();
    }
}